import Vue from 'vue'
import Router from 'vue-router'


import login from '@/components/login_components/login'
import forget from '@/components/login_components/forget'
// import changePassword from '@/components/firstPage_components/changePassword'
// import changePhoneNext from '@/components/firstPage_components/changePhoneNext'
// import changePhone from '@/components/firstPage_components/changePhone'
// import sendCode from '@/components/firstPage_components/sendCode'
// import home from '@/components/home'
import main from '@/components/main'




Vue.use(Router)
export default new Router({
  routes: [
    {
      path: '*',
      redirect: '/login'
    },
    {
      path: '/login',
      name: 'login',
      component: login
    },
    {
      path: '/forget',
      name: 'forget',
      component: forget
    },

    {
      path: '/main',
      component: main,
      //在main当中的子路由(除home)请严格按照路导航的次数来添加路由
      //例子：首页 > 常见问题 > 分类名称 > 详情，那么路由：/issue/classify / details
      //注意事项：当路由为数字时开头不会解析该字段
      children: [
        { path: '/main', redirect: '/home' },
        {
          path: '/home',
          component: resolve => require(['@/components/home/home.vue'], resolve)
        },
        {
          path: '/video_only',
          component: resolve =>
            require(['@/components/videoFile/only_video.vue'], resolve)
        },
        {
          path: '/video_seriec',
          component: resolve =>
            require(['@/components/videoFile/seriec_video.vue'], resolve)
        },
        {
          path: '/video_only/only_up/:videoId',
          component: resolve =>
            require(['@/components/videoFile/up_only_video.vue'], resolve)
        },
        {
          path: '/video_seriec/seriec_up/:videoId',
          component: resolve =>
            require(['@/components/videoFile/up_seriec_video.vue'], resolve)
        },
        {
          path: '/changePassword',
          component: resolve =>
            require([
              '@/components/firstPage_components/changePassword.vue'
            ], resolve)
        },
        {
          path: '/changePhoneNext/:oldCode',
          component: resolve =>
            require([
              '@/components/firstPage_components/changePhoneNext.vue'
            ], resolve)
        },
        {
          path: '/sendCode',
          component: resolve =>
            require(['@/components/firstPage_components/sendCode.vue'], resolve)
        },
        {
          path: '/changePhone',
          component: resolve =>
            require([
              '@/components/firstPage_components/changePhone.vue'
            ], resolve)
        },
        {
          path: '/token',
          component: resolve =>
            require(['@/components/sub_components/up_video.vue'], resolve)
        },
        {
          path: '/video_seriec/all_video/:videoId',
          component: resolve =>
            require(['@/components/videoFile/up_all_video.vue'], resolve)
        },
        {
          path: '/identityApprove',
          component: resolve =>
            require(['@/components/firstPage_components/identityApprove.vue'], resolve)
        },
        {
          path: '/professionalApprove',
          component: resolve =>
            require(['@/components/firstPage_components/professionalApprove.vue'], resolve)
        },
        {
          path: '/degreeApprove',
          component: resolve =>
            require(['@/components/firstPage_components/degreeApprove.vue'], resolve)
        },
        {
          path: '/teacherApprove',
          component: resolve =>
            require(['@/components/firstPage_components/teacherApprove.vue'], resolve)
        },
        {
          path: '/studentApprove',
          component: resolve =>
            require(['@/components/firstPage_components/studentApprove.vue'], resolve)
        },
        {
          path: '/educationApprove',
          component: resolve =>
            require(['@/components/firstPage_components/educationApprove.vue'], resolve)
        },
        {
          path: '/dataEdit',
          component: resolve =>
            require(['@/components/firstPage_components/dataEdit.vue'], resolve)
        }
      ]
    }
  ],
  scrollBehavior(to, from, savedPosition) {
    // 每次路由切换页面滚动到顶部
    return { x: 0, y: 0 }
  }
})
